<template>
	<view id="view">
		<image id="logo" src="../../static/nefu_logo.png" mode="aspectFit"></image>
		<view style="width: 60%;margin: 50upx auto;">
			<u--input
			    placeholder="请输入学工部账号"
			    border="surround"
				color="#fff"
			    v-model="account">
			</u--input>
			<view style="height: 30upx;"></view>
			<u--input
			    placeholder="请输入学工部密码"
			    border="surround"
				password
				color="#fff"
			    v-model="password">
			</u--input>
			<view @click="submit" class="flex-center-center"
				  style="background-color: #009f77;width: 90px;height: 90px;border-radius: 50%;margin:50upx auto">
				<u-icon name="arrow-rightward" size="50"></u-icon>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				account:'',
				password:''
			}
		},
		onLoad() {

		},
		methods: {
			submit(){
				const that = this
				if(that.account.length==0||that.password.length==0){
					uni.showToast({
						title:"学工号和密码不能为空",
						icon:"error"
					})
					return
				}
				that.API({
					showLoading:true,
					url:"/auth/login",
					method:'post',
					data:{
						account:that.account,
						password:that.password
					},
					code0:function(res){
						uni.setStorageSync("account", res.data.data.info.account)
						uni.setStorageSync("password", res.data.data.info.password)
						uni.reLaunch({
							url:"/pages/index/index"
						})
					},
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	#view{
		#logo{
			width: 300upx;
			height: 300upx;
			display: block;
			margin: 0 auto;
			padding-top: 50upx;
		}
		height: 100vh;
		background-color: var(--theme-color);
	}
</style>
